package me.zhanshi123.pixelpaygui;

import io.izzel.taboolib.loader.Plugin;
import me.zhanshi123.pixelpaygui.gui.CommonGuiUtil;
import me.zhanshi123.pixelpaygui.gui.open.OpenGuiListener;
import me.zhanshi123.pixelpaygui.gui.paykit.PayKitGuiListener;
import me.zhanshi123.pixelpaygui.gui.paymoney.PayGuiListener;
import org.bukkit.Bukkit;

@Plugin.Version(5.25)
public class Main extends Plugin {
    public static Main instance;

    @Override
    public void onStarting() {
        instance = this;
        initInventory();
        Bukkit.getPluginManager().registerEvents(new PayKitGuiListener(), instance);
        Bukkit.getPluginManager().registerEvents(new PayGuiListener(), instance);
        Bukkit.getPluginManager().registerEvents(new OpenGuiListener(), instance);
    }

    @Override
    public void onStopping() {

    }

    public void initInventory() {
        switch (ConfigManager.INSTANCE.getConfig().getInt("method")) {
            case 1:
                CommonGuiUtil.INSTANCE.initHeadInventory();
                break;
            case 2:
                CommonGuiUtil.INSTANCE.initOptifineInventory();
                break;
            default:
                CommonGuiUtil.INSTANCE.initHeadInventory();
                getLogger().info("界面加载方式配置异常，使用默认配置");
                break;
        }
    }
}
